package LeetCode.exercise;

public class LC137 {
    public static void main(String[] args) {
        System.out.println(singleNumber(new int[]{2, 2, 3, 2}));
    }
    public static int singleNumber(int[] nums) {
        int res = 0;
        for(int i = 2; i >= 0; i--){
            res = res << 1;
            int sum = 0;
            for(int num : nums){
                sum = (sum + ((num >> i) & 1)) % 3;
            }
            res = res + sum;
        }
        return res;
    }
}
